Cover TOC Chap Prev Chap Prev Fig Next Fig Next Chap

Chapter 25: Controlling Detail

../ch25/25fig01.gif
Figure 25.1

A high-detail torch.

25fig01.wrl
Click on the image to view the VRML scene.

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Transform {
    translation 0.0 0.0 0.2
    scale 0.5 0.5 0.5
    children [
    # Torch handle
        Transform {
            translation 0.0 -0.75 0.0
            rotation 1.0 0.0 0.0 3.14
            children Shape {
                appearance DEF Gray Appearance {
                    material Material {
                        diffuseColor  0.4 0.4 0.4
                        specularColor 0.7 0.7 0.7
                    }
                }
                geometry Cone {
                    height 1.5
                    bottomRadius 0.15
                }
            }
        },
    # Fire pot
        DEF Ring Shape {
            appearance USE Gray
            geometry Cylinder {
                height 0.1
                radius 0.4
                top    FALSE
                bottom FALSE
            }
        },
        Transform { translation 0.0 0.2 0.0 children USE Ring },
    # Fire pot detail
        DEF Bar Shape {
            appearance USE Gray
            geometry IndexedFaceSet {
                coord Coordinate {
                    point [
                         0.04 0.00 0.38,  0.04 0.35 0.38,
                        -0.04 0.35 0.38, -0.04 0.00 0.38,
                    ]
                }
                coordIndex [ 0, 1, 2, 3 ]
            }
        },
        Transform { rotation 0.0 1.0 0.0 -1.571 children USE Bar },
        Transform { rotation 0.0 1.0 0.0 -0.785 children USE Bar },
        Transform { rotation 0.0 1.0 0.0  0.785 children USE Bar },
        Transform { rotation 0.0 1.0 0.0  1.571 children USE Bar },
    # Mounting bracket
        Transform {
            translation 0.0 -0.35 0.0
            children [
                Shape {
                    appearance USE Gray
                    geometry Cylinder {
                        height 0.15
                        radius 0.20
                    }
                },
                Transform {
                    translation 0.0 0.0 -0.2
                    children Shape {
                        appearance USE Gray
                        geometry Box { size 0.45 0.25 0.39 }
                    }
                }
            ]
        },
    # Flames
        DEF Flames Shape {
            # No appearance, use emissive shading
            geometry IndexedFaceSet {
                coord Coordinate {
                    point [
                         0.25 0.0 0.00,  0.15 1.0 0.10,
                         0.05 0.0 0.15,  0.18 0.0 0.05,
                         0.00 1.2 0.05, -0.10 0.0 0.05,
                        -0.00 0.0 0.15, -0.13 0.8 0.10,
                        -0.25 0.0 0.00,
                    ]
                }
                color Color {
                    color [
                        1.0 0.0 0.0,  0.9 0.5 0.0,
                        1.0 0.0 0.0,  0.9 0.3 0.0,
                        1.0 1.0 0.0,  0.9 0.3 0.0,
                        0.7 0.1 0.2,  0.9 0.8 0.0,
                        1.0 0.0 0.0,
                    ]
                }
                coordIndex [
                    0, 1, 2, -1,  3, 4, 5, -1,  6, 7, 8, -1,
                ]
            }
        },
    # Additional Flames
        Transform {
            rotation 0.0 1.0 0.0 1.57
            scale    0.9 0.9 1.0
            children USE Flames
        },
        Transform {
            rotation 0.0 1.0 0.0 -1.57
            scale    0.9 0.9 1.0
            children USE Flames
        }
    ]
}